﻿using System;
using Vowei.Data.Models;
using System.Web.Security;
using Vowei.Web.Models;

namespace Vowei.Web.Security
{
    public class LiveMembershipSerive : IMembershipService
    {
        private static LiveMembershipSerive _SingletonInstance;
        public static LiveMembershipSerive SingletonInstance
        {
            get 
            {
                // TODO: 解决多线程并发的情况，可以google搜索一下例子
                if (_SingletonInstance == null)
                {
                    _SingletonInstance = new LiveMembershipSerive();
                }

                return _SingletonInstance;
            }        
        }

        #region IMembershipService Members

        public int MinPasswordLength
        {
            get { throw new NotImplementedException(); }
        }

        public bool ValidateUser(string userName, string password)
        {
            throw new NotImplementedException("由于在程序编写的时候，程序尚未申请域名，因此这个功能暂时无法实现，Live SDK的文档以及相关示例可以参考：http://msdn.microsoft.com/en-us/library/ff752317.aspx");
        }

        public MembershipCreateStatus CreateUser(string userName, string password, string email)
        {
            throw new NotImplementedException("针对Windows Live帐号，尚不支持从网站创建Live帐号！");
        }

        public bool ChangePassword(string userName, string oldPassword, string newPassword)
        {
            throw new NotImplementedException("针对Windows Live帐号，尚不支持从网站更改Live帐号密码，请通过Windows Live Messenger更改帐号密码！");
        }

        #endregion
    }

}